import Entity from './Entity'

const { ccclass, property } = cc._decorator;

@ccclass
export default class Wall extends cc.Component implements Entity {
    tiledLayer:cc.TiledLayer=null;
    doEvent(v3: cc.Vec3,node:cc.Node){
        //throw new Error('Method not implemented.');
    }

    isCanMove(v3: cc.Vec3): boolean {
        let gid = this.tiledLayer.getTileGIDAt(v3.x, v3.y)
        if (gid != 0) {
            return false
        }
        return true
    }
    event(self: cc.Node, node: cc.Node): boolean {
        return true;
    }

    initNode() {
        let tiled=this.node.getComponent(cc.TiledMap);
        this.tiledLayer=tiled.getLayer('wall');
    }

    onLoad() {
        this.initNode();
    }

    start() {

    }
}
